//
//  GPosAPI.m
//  gpos_app
//
//  Created by 崔航飞 on 2018/8/22.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "GPosAPI.h"
#import "Tools.h"
#import "AFNetworking.h"
#import "Group.h"
#import "SVProgressHUD.h"
#import "MJRefresh.h"
@implementation GPosAPI
typedef void (^GPosDataBlock)(id obj);
// 向服务器请求数据
+(void)getDataFromServerWithStr:(NSString*)str andParameters:(NSDictionary*)para andCallback:(GPosDataBlock)dataBlock{
    
    AFHTTPSessionManager *manager=[AFHTTPSessionManager manager];
    manager.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];
    
    
    manager.requestSerializer = [AFJSONRequestSerializer serializer];//请求
    manager.responseSerializer = [AFHTTPResponseSerializer serializer];//响应
    // 2.设置证书模式
    NSString * cerPath = [[NSBundle mainBundle] pathForResource:@"www.gpos-wallet.com" ofType:@"cer"];
    NSData * cerData = [NSData dataWithContentsOfFile:cerPath];
    manager.securityPolicy.pinnedCertificates = [[NSArray alloc] initWithObjects:cerData, nil];
    // 客户端是否信任非法证书
    manager.securityPolicy.allowInvalidCertificates = YES;
    // 是否在证书域字段中验证域名
    [manager.securityPolicy setValidatesDomainName:NO];
    
    [manager.requestSerializer setValue:@"iphone"forHTTPHeaderField:@"user-agent"];
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"user_token"]==nil) {
        [manager.requestSerializer setValue:@""forHTTPHeaderField:@"user-token"];
    }else{
        
        [manager.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"user_token"]forHTTPHeaderField:@"user-token"];
    }
    
    
    if ([[NSUserDefaults standardUserDefaults] objectForKey:@"userId"]==nil) {
        
        [manager.requestSerializer setValue:@""forHTTPHeaderField:@"userId"];
    }else{
        [manager.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"]forHTTPHeaderField:@"userId"];
    }
    manager.requestSerializer.timeoutInterval = 50;
    [manager POST:str parameters:para constructingBodyWithBlock:^(id<AFMultipartFormData>  _Nonnull formData) {
        
    } success:^(NSURLSessionDataTask * _Nonnull task, id  _Nonnull responseObject) {
        
        dataBlock(responseObject);
    } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) {

         NSLog(@"GET 请求失败: %@ ", error);
        [SVProgressHUD dismiss];
        [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
        [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
        [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
        dataBlock(NULL);
        NSLog(@"请求失败...");
    }];
    
}
+(void)getDataFromServerWithGETStr:(NSString*)str andParameters:(NSDictionary*)para andCallback:(GPosDataBlock)dataBlock{
    
    // 创建请求 Manager 对象
    AFHTTPRequestOperationManager *mgr = [AFHTTPRequestOperationManager manager];
    mgr.responseSerializer.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript",@"text/html",@"text/plain", nil];
    
    
    mgr.requestSerializer = [AFJSONRequestSerializer serializer];//请求
    mgr.responseSerializer = [AFHTTPResponseSerializer serializer];//响应
    mgr.requestSerializer = [AFJSONRequestSerializer serializer];//请求
    mgr.responseSerializer = [AFHTTPResponseSerializer serializer];//响应
    // 2.设置证书模式
    NSString * cerPath = [[NSBundle mainBundle] pathForResource:@"www.gpos-wallet.com" ofType:@"cer"];
    NSData * cerData = [NSData dataWithContentsOfFile:cerPath];
    mgr.securityPolicy.pinnedCertificates = [[NSArray alloc] initWithObjects:cerData, nil];
    // 客户端是否信任非法证书
    mgr.securityPolicy.allowInvalidCertificates = YES;
    [mgr.securityPolicy setValidatesDomainName:NO];
    [mgr.requestSerializer setValue:@"iphone"forHTTPHeaderField:@"user-agent"];
    [mgr.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"user_token"]forHTTPHeaderField:@"user-token"];
    [mgr.requestSerializer setValue:[[NSUserDefaults standardUserDefaults] objectForKey:@"userId"]forHTTPHeaderField:@"userId"];
    
    mgr.requestSerializer.timeoutInterval = 50;
    [mgr GET:str parameters:para success:^(AFHTTPRequestOperation *operation, id responseObject) {
        
        // responseObject 里面, 是请求成功以后返回的字典或者数据, 然后对其进行解析
        dataBlock(responseObject);
        
    } failure:^(AFHTTPRequestOperation *operation, NSError *error) {
        
        NSLog(@"GET 请求失败: %@ ", error);
        [SVProgressHUD dismiss];
        [SVProgressHUD showErrorWithStatus:@"请求失败,请检查您的网络状态"];
        [SVProgressHUD setDefaultStyle:SVProgressHUDStyleDark];
        [SVProgressHUD setDefaultAnimationType:SVProgressHUDAnimationTypeFlat];
        dataBlock(NULL);
    }];
    
}

+(void)requestSendCodeWithParams:(NSDictionary *)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/user/sendCode";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
        NSDictionary* dic = [Group parseSendCodeByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestRegisterWithParams:(NSDictionary *)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/register";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
        NSDictionary* dic = [Group parseRegisterByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestLogInWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/login";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
       NSDictionary* dic = [Group parseLoginByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestverifyLogInWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/verifyLogin";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
        NSDictionary* dic = [Group parseverifyLoginByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestverifyLogOutWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/logout";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];

    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {

        NSDictionary* dic = [Group parseLogoutByDic:obj];
        callback(dic);
    }];

}

+(void)requestForgetPasswordWithParams:(NSDictionary *)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/forgetPassword";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
        NSDictionary* dic = [Group parseForgetPasswordByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestVersonWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/version/getVersion";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    

}
+(void)requestMoneyAddressWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/getAccountAddress";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
//查看所有店铺
+(void)requestverifyAllMerchantWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/mall/searchMerchant";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseLogoutByDic:obj];
        callback(dic);
    }];
}
//查看店铺分类
+(void)requestverifyMerchantTypeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/mall/typeList";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestTradePasswordWithParams:(NSDictionary *)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/setTradePassword";
    
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        
        NSDictionary* dic = [Group parseLoginByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestTotalBalanceWithParams:(NSDictionary *)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/points/rank/totalBalance";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestHomePageWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/points/rank/homePage";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestIncomeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/points/rank/income";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestAdvertisementWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/mall/advertisement";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestTeamWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/index/team";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestGetUserMinerNumberWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/miner/getUserMinerNumber";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestNoticeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/message/list";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestDelegateNoticeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/message/action";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestUserInfosWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/userInfo";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestConfigUserInfosWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/setDetail";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestAllRankWithParams:(NSDictionary*)para andCallback:(GposCallback)callback {
    
    NSString* apiStr = @"/points/rank/allRank";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestServiceAndSecurtWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/rule/getRule";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestTodayRankWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/user/newUser";
    
//    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
//    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
//        NSDictionary* dic = [Group parseVerSionByDic:obj];
//        callback(dic);
//    }];
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestGetAccountAddressWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/user/getAccountAddress";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestTransferAccountWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/pay/transferAccount";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestMerchantTypeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/mall/typeList";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestChangeloginPasswordWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/changePassword";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestForgetJYPasswordloginPasswordWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/user/forgetPassword";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestGetUserMinerWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/miner/getUserMiner";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseGetUserMinerByDic:obj];
        callback(dic);
    }];
    
}

+(void)requestGetUserMinerDetailListWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/miner/getUserMinerDetailList";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestGetUserMinerDetailWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/miner/getUserMinerDetail";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseGetUserMinerDetailByDic:obj];
        callback(dic);
    }];
    
    
}

+(void)requestCampaignBillWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/campaign/rank/campaignBill";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseGetUserMinerDetailByDic:obj];
        callback(dic);
    }];
    
}
//意见反馈
+(void)requestFeedBacksWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/member/advice";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
//竞选余额
+(void)requestBalanceWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/campaign/rank/balance";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseBalanceByDic:obj];
        callback(dic);
    }];
    
}
//查看竞选是否开启
+(void)requestOpenWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/campaign/rank/open";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseOpenByDic:obj];
        callback(dic);
    }];
    
    
}

//查看往期竞选数据和倒计时
+(void)requestPhaseWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/campaign/rank/phase";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parsePhaseByDic:obj];
        callback(dic);
    }];
    
    
}
//
+(void)requestRankViewWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/campaign/rank/view";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseRankViewByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestAllIncomeWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/points/rank/allIncome";
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseAllIncomeByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestMySelfMerchantWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/mall/myselfMerchant";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestCampaignWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/campaign/rank/campaign";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
}
+(void)requestBillWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/pay/bill";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseVerSionByDic:obj];
        callback(dic);
    }];
    
    
}
+(void)requestorderDetailWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/pay/orderDetail";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseOrderDetailByDic:obj];
        callback(dic);
    }];
    
    
}

//+(void)requestPosInfoWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
//    NSString* apiStr = @"/index/posInfo";
//    
//    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
//    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
//        NSDictionary* dic = [Group parsePosInfoByDic:obj];
//        callback(dic);
//    }];
//    
//    
//}
//+(void)requestTeamInfoWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
//    NSString* apiStr = @"/index/teamInfo";
//
//    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
//    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
//        NSDictionary* dic = [Group parseTeamInfoByDic:obj];
//        callback(dic);
//    }];
//
//}

+(void)requestDirectInfoWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/index/directInfo";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseTeamInfoByDic:obj];
        callback(dic);
    }];

    
}
+(void)requestTransferAccountPosWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/pay/transferAccountPos";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseTransferAccountPosByDic:obj];
        callback(dic);
    }];
    
    
}
//GPOS智能商家
+(void)requestGposZNMerchantWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"http://cxcapi.chuxiaocheng.cn/posMerInfo";
    
    [self getDataFromServerWithStr:apiStr andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseTransferAccountPosByDic:obj];
        callback(dic);
    }];
}

//登录交易所
+(void)requestLoninDLWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/exchange/login";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseLoninDLByDic:obj];
        callback(dic);
    }];
    
}

//转账交易所
+(void)requestDivertZZWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/exchange/divert";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseDivertZZByDic:obj];
        callback(dic);
    }];
    
}

// 检查用户是否有身份验证失败
//member/identityResult
+(void)requestIdentityResultWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/member/identityResult";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseIdentityResultByDic:obj];
        callback(dic);
    }];
    
}

//登录闪电网络
+(void)requestOTCLoninWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/otc/login";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseOTCLoninByDic:obj];
        callback(dic);
    }];
    
    
}
//转账闪电网络
+(void)requestOTCDivertWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/otc/divert";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseOTCDivertByDic:obj];
        callback(dic);
    }];
    
}
//获取绑定银行卡
+(void)requestGetBankCardWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/member/getBankCard";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseGetBankCardByDic:obj];
        callback(dic);
    }];
    
}

//绑定银行卡
+(void)requestBindBankCardWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/member/bindBankCard";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseBindBankCardByDic:obj];
        callback(dic);
    }];
    
}

//获取银行列表
+(void)requestGetBankInfoWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/member/getBankInfo";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseGetBankInfoByDic:obj];
        callback(dic);
    }];
    
}

///hold/viewHoldInfo查看储存信息
+(void)requestViewHoldInfoWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/hold/viewHoldInfo";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseViewHoldInfoByDic:obj];
        callback(dic);
    }];
    
}

///hold/viewDetailList获取转入详情列表
+(void)requestViewDetailListWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/hold/viewDetailList";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseViewDetailListByDic:obj];
        callback(dic);
    }];
    
}

//储存/hold/storageAmount
+(void)requestStorageAmountWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/hold/storageAmount";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseStorageAmountByDic:obj];
        callback(dic);
    }];
    
}
//储存列表/hold/viewIncomeOrderList
+(void)requestViewIncomeOrderListWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/hold/viewIncomeOrderList";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithGETStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseViewIncomeOrderListByDic:obj];
        callback(dic);
    }];
    
}
// 显示业绩销量/index/salesCommission
+(void)requestSalesCommissionWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    NSString* apiStr = @"/index/salesCommission";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseSalesCommissionByDic:obj];
        callback(dic);
    }];
    
}
//销量详情/index/saleDetail
+(void)requestSaleDetailWithParams:(NSDictionary*)para andCallback:(GposCallback)callback{
    
    NSString* apiStr = @"/index/saleDetail";
    
    NSString* str = [Tools appendSeverAddressWithStr:apiStr];
    [self getDataFromServerWithStr:str andParameters:para andCallback:^(id obj) {
        NSDictionary* dic = [Group parseSaleDetailByDic:obj];
        callback(dic);
    }];
}
@end
